<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="lib/jquery-3.2.1.js"></script>
    <style>
        /* @keyframes scroll{
            from{
                left: 500px;
            }
            to{
                left: 0;
            }
        } */
        *{
            margin: 0;
            padding: 0;
        }
        .banner-box{
            width: 500px;
            height: 300px;
            border: 1px solid #333333;
            margin: 0 auto;
            position: relative;
            overflow: hidden;
        }
        .banner-image-box{
            width: 600%;
            height: 100%;
        }
        .banner-image-box ul{
            position: absolute;
            top: 0;
            list-style: none;
            width: 100%;
            height: 100%;
            transition:transform 2s;
        }
        .banner-image-box ul:first-child{
            background-color: red;
            left: 0;
        }
        .banner-image-box ul:nth-child(2){
            background-color: green;
            left: 500px;
        }
        .banner-image-box ul:nth-child(3){
            background-color: yellow;
            left: 1000px;
        }
        .banner-image-box ul:nth-child(4){
            background-color: purple;
            left:1500px;
        }
        #prev,#next{
            width: 20px;
            height: 20px;
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            background-color: black;
        }
        #next{
            position: absolute;
            left: 480px;
            top: 50%;
            transform: translateY(-50%);
        }
    </style>
</head>
<body>
    <div class="banner-box">
        <div class="banner-image-box">
            <ul id="1">123</ul>
            <ul id="2"></ul>
            <ul id="3"></ul>
            <ul id="4"></ul>
        </div>
        <div id="prev"></div>
        <div id="next"></div>
    </div>
    <script>
        var palace = 0
        $("#next").click(function(){
            palace++
            var a = palace%4
            console.log(a)
            if (a == 0){
                $("#4").css({transform:"translateX(-500px)"})
                $("#1").css({transform:"translateX(-500px)"})
                $("#2").css({left:"-500px",transform:"translateX(0)"})
                $("#3").css({left:"-500px"})
            }
            if (a == 1){
                $("#1").css({transform:"translateX(-500px)"})
                $("#2").css({transform:"translateX(-500px)"})
                $("#3").css({left:"500px"})
                $("#4").css({left:"-500px",transform:"translateX(0)"})
            }
            if (a == 2){
                $("#1").css({left:"-500px",transform:"translateX(0)"})
                $("#2").css({transform:"translateX(-500px)"})
                $("#3").css({transform:"translateX(-500px)"})
                $("#4").css({left:"500px"})
            }
            if (a == 3){
                $("#1").css({left:"500px"})
                $("#2").css({left:"-500px",transform:"translateX(0)"})
                $("#3").css({transform:"translateX(-500px)"})
                $("#4").css({transform:"translateX(-500px)"})
            }
        })
    </script>
</body>
</html>